package com.hebust.controller;

import com.hebust.service.TeachersService;
import com.hebust.utils.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController  // 控制层 异步的  所有控制层类都要加
@Api(value = "提供了教师的相关接口", tags = "教师模块")  // 类注解  对该控制器类进行功能说明
@CrossOrigin  // 解决跨域问题
public class TeacherController {

    @Autowired
    private TeachersService teachersService;

    @GetMapping("/my_score")
    @ApiOperation("查询教师的评分信息")
    public ResultVo my_score(int tid) {
        return teachersService.my_score(tid);
    }

    @PutMapping("/update_teacherpassword")
    @ApiOperation("教师密码更改")
    public ResultVo update_teacherpassword(int tid, String password) {
        return teachersService.update_teacherpassword(tid, password);
    }

    @GetMapping("/show_studentscore")
    @ApiOperation("教师成绩查询")
    public ResultVo show_studentscore(int tid, String cname, String sname, @RequestParam(defaultValue = "1") int pageNum) {
        return teachersService.show_studentscore(tid, cname, sname, pageNum);
    }

    @PutMapping("/add_studentscore")
    @ApiOperation("教师打分接口")
    public ResultVo add_studentscore(int id, int score) {
        return teachersService.add_studentscore(id, score);
    }

    @GetMapping("/show_teachercourse")
    @ApiOperation("授课查询接口")
    public ResultVo show_teachercourse(int tid, @RequestParam(defaultValue = "1") int pageNum) {
        return teachersService.show_teachercourse(tid, pageNum);
    }

    @PutMapping("/edit_courseinformation")
    @ApiOperation("编辑考试时间和地点")
    public ResultVo edit_courseinformation(int id, String etime, String elocation) {
        return teachersService.edit_courseinformation(id, etime, elocation);
    }

    // 课表
    @GetMapping("/show_teachercourseschedule")
    @ApiOperation("教师课表查询接口")
    public ResultVo show_teachercourseschedule(int tid) {
        return teachersService.show_teachercourseschedule(tid);
    }

}
